package com.huike.web.controller.clues;

import java.util.Date;
import java.util.List;

import com.huike.clues.domain.vo.ClueTrackRecordVoWy;
import com.huike.clues.domain.vo.TbClueTrackRecordGT;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.huike.clues.domain.TbClue;
import com.huike.clues.domain.TbClueTrackRecord;
import com.huike.clues.domain.vo.ClueTrackRecordVo;
import com.huike.clues.service.ITbClueTrackRecordService;
import com.huike.common.annotation.Log;
import com.huike.common.core.controller.BaseController;
import com.huike.common.core.domain.AjaxResult;
import com.huike.common.core.page.TableDataInfo;
import com.huike.common.enums.BusinessType;
import com.huike.common.utils.DateUtils;
import com.huike.common.utils.SecurityUtils;

/**
 * 线索跟进记录Controller
 * @date 2021-04-22
 */
@RestController
@RequestMapping("/clues/record")
public class TbClueTrackRecordController extends BaseController {
    @Autowired
 private ITbClueTrackRecordService itb;
    @PostMapping
    public AjaxResult clueTrackRecord(@RequestBody ClueTrackRecordVoWy clueTrackRecordVoWy){
        System.out.println(clueTrackRecordVoWy.toString());
        clueTrackRecordVoWy.setCreateBy("wy");
        clueTrackRecordVoWy.setCreateTime(new Date());

        if(clueTrackRecordVoWy.getType()!=null){
        }else {
            clueTrackRecordVoWy.setType("0");
        }
        int i = itb.addClueTrack(clueTrackRecordVoWy);
        int i2 = itb.updateTbClue(clueTrackRecordVoWy);

//age name sex weixin qq
        return AjaxResult.success("操作成功");
    }

    @GetMapping("/list")
    public TableDataInfo clueList(Integer clueId){
        List<TbClueTrackRecordGT> clueTrackRecordVoGt = itb.selectTbClueTrackByClueId(clueId);

        return getDataTable(clueTrackRecordVoGt);
      //clue: update
    }



}